home *** CD-ROM | disk | FTP | other *** search
/ Mac Expert 1995 Winter / Mac Expert - Winter 95.iso / Les fichiers / Communications / Divers / CommAnalyzer 1.0 ƒ / Test CommAnalyzer / Test.c next >
Encoding:
C/C++ Source or Header  |  1993-07-27  |  1.3 KB  |  82 lines  |  [TEXT/KAHL]

  1. /***********************************************************************
  2.     Test.c
  3.     
  4.     Created:    Sunday, July 25, 1993, 11:16 PM
  5.     Project:    CommAnalyzer.π
  6.     Compiler:    6.0, © Symantec Corporation 1993
  7.     By:            Greg Ames
  8.  
  9.     Copyright © 1993,1993 Ames & Associates.
  10.     All rights reserved.
  11.     
  12.     AppleLink:AMES
  13.     AOL:AMES
  14.     Compuserve:73177,1603
  15.      
  16. ***********************************************************************/
  17. #include <Serial.h>
  18. #include <StdLib.h>
  19.  
  20. #define baud38400    1
  21.  
  22. char    buffer[] = "\p#ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ#";
  23. /****
  24.  * InitMacintosh()
  25.  *
  26.  * Initialize all the managers & memory
  27.  *
  28.  ****/
  29.  
  30. void InitMacintosh(void);
  31. void InitMacintosh(void)
  32.  
  33. {
  34.     MaxApplZone();
  35.     
  36.     InitGraf(&thePort);
  37.     InitFonts();
  38.     FlushEvents(everyEvent, 0);
  39.     InitWindows();
  40.     InitMenus();
  41.     TEInit();
  42.     InitDialogs(0L);
  43.     InitCursor();
  44.  
  45. }
  46. /* end InitMacintosh */
  47.  
  48. short    ain,aout;
  49. void    closeSerial(void);
  50.  
  51. void
  52. main( void)
  53.  
  54. {
  55.     short    err;
  56.     long count;
  57.     
  58.     InitMacintosh();
  59.     
  60.     err = OpenDriver("\p.aout",&aout);
  61.  
  62.     err = OpenDriver("\p.ain",&ain);
  63.     
  64.     err = SerReset(aout,baud38400+stop10+noParity+data8);
  65. //    err = SerReset(aout,baud19200+stop10+noParity+data8);
  66.  
  67.     _atexit(closeSerial);
  68.     count = buffer[0];
  69.     do {
  70.         err = FSWrite(aout,&count,&buffer[1]);
  71.     } while (!Button());
  72.     
  73. }
  74. /* end main */
  75.  
  76. void    closeSerial()
  77. {
  78.     short    err;
  79.     
  80.     err = CloseDriver(ain);
  81.     err = CloseDriver(aout);
  82. }